<template>
    <div>
        <div class="itembox">
            <div class="item">
                <p>11.11致热爱读书的你，邀你免费看书</p>
                <div class="imgbox">
                    <div class="img" v-for="item in express.slice(0, 4)" :key="item.bookId" @click="book(item)">
                        <img :src="item.bookCover" alt="">
                        <p class="txt">{{ item.bookName }}</p>
                    </div>

                </div>

                <div class="LookBook">
                    <p>查看书单·4本书</p>
                </div>
            </div>

            <div class="item">
                <p>11.11致热爱读书的你，邀你免费看书</p>
                <div class="imgbox">
                    <div class="img" v-for="item in express.slice(2, 6)" :key="item.bookId" @click="book(item)">
                        <img :src="item.bookCover" alt="">
                        <p class="txt">{{ item.bookName }}</p>
                    </div>

                </div>

                <div class="LookBook">
                    <p>查看书单·4本书</p>
                </div>
            </div>

            <div class="item">
                <p>11.11致热爱读书的你，邀你免费看书</p>
                <div class="imgbox">

                    <div class="img" v-for="item in express.slice(1, 5)" :key="item.bookId" @click="book(item)">
                        <img :src="item.bookCover" alt="">
                        <p class="txt">{{ item.bookName }}</p>
                    </div>



                </div>

                <div class="LookBook">
                    <p>查看书单·4本书</p>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import { getExpressData } from "../api/home.js";
export default {


    data() {
        return {
            express: [],
        }
    },

    methods: {
        getExpressDataFun() {
            getExpressData().then((data) => {
                console.log(data)
                this.express = data.records
                console.log("express", this.express)
            })
        },


        book(item){
   this.express = item
      localStorage.setItem("forms",JSON.stringify(this.express))
      this.$router.push("/DetailView")
    },


    },

    created() {
        this.getExpressDataFun()
    }
}
</script>

<style lang="scss" scoped>
.itembox {
    padding: 14px 16px;
    margin-top: 114px;

    //  background-color: #ffffff;
    .item {
        box-shadow: 5px 6px 10px #ececec;
        background-color: #ffffff;
        padding-left: 15px;
        padding-top: 20px;
        border-radius: 6px;
        margin-bottom: 20px;

        p {
            font-size: 15px;
            color: #121f36;
            font-weight: bold;
            padding-bottom: 16px;
            padding-left: 2px;
        }

        .imgbox {
            display: flex;
            // padding-left:6px;
            justify-content: space-around;

            .img {

                img {
                    width: 48px;
                    height: 70px;
                }

                p.txt {
                    font-size: 12px;
                    width: 58px;
                    color: #454f61;
                }
            }
        }

        .LookBook {
            display: flex;
            padding-bottom: 20px;

            p {
                font-size: 13px;
                color: #9aa1ab;
                padding: 10px 110px;
                background-color: #f5f5f5;
                border-radius: 20px;
            }
        }
    }
}
</style>